package com.nemesis.android.helloworld;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.KeyEvent;
import android.widget.*;
//import android.graphics.Bitmap;

public class HelloWorld extends Activity
{
    private Preview mPreview;
    /** Called with the activity is first created. */
    @Override
	protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        
        // Hide the window title.
        requestWindowFeature(Window.FEATURE_NO_TITLE);
       
        // Create our Preview view and set it as the content of our
        // Activity
        //mPreview = new Preview(this);
        
        setContentView(R.layout.main);
        
        mPreview = (Preview)findViewById(R.id.view);
        if(mPreview != null)
        {
        	TextView texte = (TextView)findViewById(R.id.texte);
        
        	texte.setText("Testagetation");
        }
        
        //setContentView(mPreview);
        
    }
    
    @Override
	protected void onResume() {
        // Because the CameraDevice object is not a shared resource,
        // it's very important to release it when the activity is paused.
        super.onResume();
        if(mPreview != null)
        	mPreview.resume();
    }

    @Override
	protected void onPause() {
        // Start Preview again when we resume.
        super.onPause();
        if(mPreview != null)
        	mPreview.pause();
    }
    
    public boolean onKeyDown(int keyCode, KeyEvent keyevent) {
    	if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER && mPreview != null) {
    		if(mPreview.isPaused())
    			mPreview.resume();
    		else mPreview.pause();
           return true;
        }
        return false;
    }
}